<template>
    <div class="segment-content-box">
        <a-tabs v-model:activeKey="tabsModeValue">
            <a-tab-pane key="人员和文件信息" tab="人员和文件信息">
                <a-collapse v-model:activeKey="collapseActiveKeyArr" class="tabs-collapse-box">
                    <!-- ================ -->
                    <a-collapse-panel key="1" header="审评方案信息">
                        <!-- <template #extra>
                            <span v-if="collapseActiveKeyArr.indexOf('1') !== -1" 
                            @click="collapseActiveKeyArr = collapseActiveKeyArr.filter(item => item !== '1')">折叠</span>
                            <span v-else @click="collapseActiveKeyArr.push('1')">展开</span>
                        </template>-->
                        <commpVxeTable
                            :key="inspectionPlanRefresh"
                            :config="inspectionPlanConfig" 
                            :columns="inspectionPlanColumns"
                            :formItem="[]" 
                            :adaptiveHeight="true"
                        > 
                            <template v-slot:fwjccmc_slots="{row}" data-desc="自定操作栏">
                                <span>{{ row.fwjxsmc }}{{ row.fwjlx }}</span>
                            </template>
                            <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                                <a-form layout="inline" class="search-form" >
                                    <a-form-item class="vxe-table-box-w">
                                        <a-button class="blue-btn" type="primary" @click="viewClick(row)" >查看</a-button>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w">
                                        <a-button class="blue-btn" type="primary" @click="downloadClick(row,'审评方案')" >下载</a-button>
                                    </a-form-item>
                                </a-form>
                            </template>
                        </commpVxeTable>
                    </a-collapse-panel>
                    <!-- ==================== -->
                    <a-collapse-panel key="2" header="专家签到表">
                        <!-- <template #extra>
                            <span v-if="collapseActiveKeyArr.indexOf('2') !== -1" 
                            @click="collapseActiveKeyArr = collapseActiveKeyArr.filter(item => item !== '2')">折叠</span>
                            <span v-else @click="collapseActiveKeyArr.push('2')">展开</span>
                        </template>-->
                        <a-form layout="inline" style="margin-bottom:10px">
                            <a-form-item v-if="!addEdittechnicalReview.isHidden">
                                <a-button class="blue-btn" type="primary" @click="generateRecord('专家签到表','专家签到表')" >生成记录</a-button>
                            </a-form-item>
                        </a-form>
                        <commpVxeTable
                            :key="honestAutonomyRefresh"
                            :config="honestAutonomyConfig" 
                            :columns="honestAutonomyColumns"
                            :formItem="[]"
                            :adaptiveHeight="true"
                        > 
                            <template v-slot:fwjccmc_slots="{row}" data-desc="自定操作栏">
                                <span>{{ row.fwjxsmc }}{{ row.fwjlx }}</span>
                            </template>
                            <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                                <a-form layout="inline" class="search-form" >
                                    <a-form-item class="vxe-table-box-w">
                                        <a-button class="blue-btn" type="primary" @click="viewClick(row)" >查看</a-button>
                                    </a-form-item>
                                    <a-form-item v-if="editMode == '服务端模式'">
                                        <!-- 服务端编辑 -->
                                        <a-button class="blue-btn" type="primary" @click="serverEdit(row)" >编辑</a-button>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w" v-if="!addEdittechnicalReview.isHidden && row.fwjlx !== '.pdf' && editMode == '客户端模式'">
                                        <a-button class="blue-btn" type="primary" @click="editClick(row,'专家签到表')" >编辑</a-button>
                                    </a-form-item>
                                    <a-form-item  v-if="row.fwjlx == '.pdf' && editMode == '客户端模式'">
                                            <a-button class="blue-btn dMould-btn" type="primary" @click="againEdit(row,'专家签到表')" >重新编辑</a-button>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w" v-if="!addEdittechnicalReview.isHidden">
                                        <a-button class="red-btn" type="primary" @click="deleteClick(row,'专家签到表')" >删除</a-button>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w" v-if="!addEdittechnicalReview.isHidden">
                                        <a-upload style="display: inline-block;" :beforeUpload="segmentBeforeUpload" action="" @change="uploadClick($event,row,'专家签到表')">
                                            <a-button class="blue-btn" type="primary">上传</a-button>
                                        </a-upload>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w">
                                        <a-button class="blue-btn" type="primary" @click="downloadClick(row,'专家签到表')" >下载</a-button>
                                    </a-form-item>
                                </a-form>
                            </template>
                        </commpVxeTable>
                    </a-collapse-panel>
                    <!-- ====================== -->
                    <a-collapse-panel key="3" header="技术审评意见审批表"> 
                        <!-- <template #extra>
                            <span v-if="collapseActiveKeyArr.indexOf('3') !== -1" 
                            @click="collapseActiveKeyArr = collapseActiveKeyArr.filter(item => item !== '3')">折叠</span>
                            <span v-else @click="collapseActiveKeyArr.push('3')">展开</span>
                        </template>-->
                        <a-form layout="inline" style="margin-bottom:10px" v-if="!addEdittechnicalReview.isHidden">
                            <a-form-item >
                                <a-button class="blue-btn" type="primary" @click="generateRecord('技术审评意见审批表','技术审评意见审批表')" >生成记录</a-button>
                            </a-form-item>
                        </a-form>
                        <commpVxeTable
                            :key="customerSatisfactionRefresh"
                            :config="customerSatisfactionConfig" 
                            :columns="customerSatisfactionColumns"
                            :formItem="[]"
                            :adaptiveHeight="true"
                        > 
                            <template v-slot:fwjccmc_slots="{row}" data-desc="自定操作栏">
                                <span>{{ row.fwjxsmc }}{{ row.fwjlx }}</span>
                            </template>
                            <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                                <a-form layout="inline" class="search-form" >
                                    <a-form-item class="vxe-table-box-w">
                                        <a-button class="blue-btn" type="primary" @click="viewClick(row)" >查看</a-button>
                                    </a-form-item>
                                    <a-form-item v-if="editMode == '服务端模式'">
                                        <!-- 服务端编辑 -->
                                        <a-button class="blue-btn" type="primary" @click="serverEdit(row)" >编辑</a-button>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w" v-if="!addEdittechnicalReview.isHidden && row.fwjlx !== '.pdf' && editMode == '客户端模式'">
                                        <a-button class="red-btn" type="primary" @click="editClick(row,'技术审评意见审批表')" >编辑</a-button>
                                    </a-form-item>
                                    <a-form-item  v-if="row.fwjlx == '.pdf' && editMode == '客户端模式'">
                                            <a-button class="blue-btn dMould-btn" type="primary" @click="againEdit(row,'技术审评意见审批表')" >重新编辑</a-button>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w" v-if="!addEdittechnicalReview.isHidden">
                                        <a-button class="red-btn" type="primary" @click="deleteClick(row,'技术审评意见审批表')" >删除</a-button>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w" v-if="!addEdittechnicalReview.isHidden">
                                        <a-upload style="display: inline-block;" :beforeUpload="segmentBeforeUpload" action="" @change="uploadClick($event,row,'技术审评意见审批表')">
                                            <a-button class="blue-btn" type="primary">上传</a-button>
                                        </a-upload>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w">
                                        <a-button class="blue-btn" type="primary" @click="downloadClick(row,'技术审评意见审批表')" >下载</a-button>
                                    </a-form-item>
                                </a-form>
                            </template>
                        </commpVxeTable>
                    </a-collapse-panel>
                    <!-- ======================== -->
                    <a-collapse-panel key="4" header="专家审评意见">
                        <!-- <template #extra>
                            <span v-if="collapseActiveKeyArr.indexOf('4') !== -1" 
                            @click="collapseActiveKeyArr = collapseActiveKeyArr.filter(item => item !== '4')">折叠</span>
                            <span v-else @click="collapseActiveKeyArr.push('4')">展开</span>
                        </template>-->
                        <a-form layout="inline" style="margin-bottom:10px" v-if="!addEdittechnicalReview.isHidden">
                            <a-form-item >
                                <a-button class="blue-btn" type="primary" @click="generateRecord('专家审评意见','专家审评意见')">生成记录</a-button>
                            </a-form-item>
                        </a-form>
                        <commpVxeTable
                            :key="noConflictOfInterestRefresh"
                            :config="noConflictOfInterestConfig" 
                            :columns="noConflictOfInterestColumns"
                            :formItem="[]" 
                            :adaptiveHeight="true"
                        > 
                            <template v-slot:fwjccmc_slots="{row}" data-desc="自定操作栏">
                                <span>{{ row.fwjxsmc }}{{ row.fwjlx }}</span>
                            </template>
                            <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                                <a-form layout="inline" class="search-form" >
                                    <a-form-item class="vxe-table-box-w">
                                        <a-button class="blue-btn" type="primary" @click="viewClick(row)" >查看</a-button>
                                    </a-form-item>
                                    <a-form-item v-if="editMode == '服务端模式'">
                                        <!-- 服务端编辑 -->
                                        <a-button class="blue-btn" type="primary" @click="serverEdit(row)" >编辑</a-button>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w" v-if="!addEdittechnicalReview.isHidden && row.fwjlx !== '.pdf' && editMode == '客户端模式'">
                                        <a-button class="blue-btn" type="primary" @click="editClick(row,'专家审评意见')" >编辑</a-button>
                                    </a-form-item>
                                    <a-form-item  v-if="row.fwjlx == '.pdf' && editMode == '客户端模式'">
                                            <a-button class="blue-btn dMould-btn" type="primary" @click="againEdit(row,'专家审评意见')" >重新编辑</a-button>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w" v-if="!addEdittechnicalReview.isHidden">
                                        <a-button class="red-btn" type="primary" @click="deleteClick(row,'专家审评意见')" >删除</a-button>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w" v-if="!addEdittechnicalReview.isHidden">
                                        <a-upload style="display: inline-block;" :beforeUpload="segmentBeforeUpload" action="" @change="uploadClick($event,row,'专家审评意见')">
                                            <a-button class="blue-btn" type="primary">上传</a-button>
                                        </a-upload>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w">
                                        <a-button class="blue-btn" type="primary" @click="downloadClick(row,'专家审评意见')" >下载</a-button>
                                    </a-form-item>
                                </a-form>
                            </template>
                        </commpVxeTable>
                    </a-collapse-panel>
                    <!-- ================== -->
                </a-collapse>
            </a-tab-pane>
            <a-tab-pane key="审评项目" tab="审评项目">
                <div style="width: 100%;">
                    <a-row style="width: 100%;">
                        <a-col :span="5">
                            <div class="tree-left-box">
                                <a-tree
                                    v-model:checkedKeys="treeCheckedKeys"
                                    :autoExpandParent="true"
                                    :defaultExpandAll="true"
                                    :selectedKeys="selectedKeys"
                                    @select="treeSelect"
                                    :tree-data="treeData"
                                />
                            </div>
                            
                        </a-col>
                        <a-col :span="19">
                            <div class="tree-right-box">
                                <commpVxeTable
                                    :key="reviewItemsRefresh"
                                    :config="reviewItemsConfig" 
                                    :columns="reviewItemsColumns" 
                                    :formItem="reviewItemsFormItem"
                                    ref="reviewItemsRef"
                                >
                                
                                    <template v-slot:name_ftype4="{row}" data-desc="自定操作栏">
                                        <div style="display: flex;height: 48px;align-items: center;">
                                            <span style="padding-right: 8px;">{{row.ftype4}}</span>
                                            <i @click="lookOverContent(row)" style="color: #5ca3e5;" class="vxe-icon-search"></i>
                                        </div>
                                    </template>
                                    <template v-slot:name_fjcjl="{row}" data-desc="自定操作栏">
                                        <compSelector
                                            v-if="!addEdittechnicalReview.isHidden"
                                            :width="105"
                                            v-model="row.fjcjl"
                                            :compType="typeSelect"
                                            :defaultValue="row.fjcjl"
                                            placeholder="审评结论"
                                            dictionaryType="审评结论"
                                            :separateAreas="'jcxmqxzt'+blobType.fywflcodeArr[blobType.menuType.indexOf(routeName.substring(routeName.indexOf('__'),routeName.indexOf('_a')+2))]"
                                            @selectHandleChange="selectHandleChange($event,row)"
                                        />
                                        <span v-else>{{ row.fjcjl }}</span>
                                    </template>
                                    <template v-slot:name_fscjl="{row}" data-desc="自定操作栏">
                                        <div
                                         @click="reviewRecordsClick(row,addEdittechnicalReview.isHidden)" 
                                         style="width: 100%; height: 48px; display: flex; align-items: center;" 
                                         v-if="reviewRecordsId !== row.id || !reviewRecordsId"
                                        >
                                            <span>{{ row.fscjl }}</span>
                                        </div>
                                        <a-input
                                            ref="userNameInput"
                                            v-if="reviewRecordsId && reviewRecordsId == row.id"
                                            @focus="reviewRecordsFocusEvent"
                                            @blur="reviewRecordsBlurEvent(row)"
                                            placeholder="请输入审评记录"
                                            v-model:value="row.fscjl"
                                        />
                                    </template>
                                    
                                </commpVxeTable>
                            </div>
                        </a-col>
                    </a-row>
                </div>
            </a-tab-pane>
            <a-tab-pane key="审评报告" tab="审评报告">
                <a-form
                ref="form"
                layout="inline" 
                :form="inspectionReportForm" 
                class="label-box-w"
                >
                    <a-form-item label="审评依据" class="segment-long-box" >
                        <!-- <a-input placeholder="请输入审评依据" v-model:value="formField.fspyj"/> -->
                        <a-textarea 
                            v-if="!addEdittechnicalReview.isHidden"
                            style="width: 100% !important;"
                            @focus="ideaFocusEvent" 
                            @blur="ideaBlur"
                            placeholder="请输入审评依据" 
                            :rows="4" 
                            v-model:value="formField.fspyj"
                        />
                        <span v-else>{{ formField.fspyj }}</span>
                        <!-- @click="ideaClick('审评依据','fspyj')"  -->
                    </a-form-item>
                    <br/>
                    <!-- <a-form-item label="审评范围" class="segment-long-box" >
                        <a-textarea 
                            @focus="ideaFocusEvent" 
                            @blur="ideaBlur"
                            placeholder="请输入审评范围" 
                            :rows="4" 
                            v-model:value="formField.fcyjcfw"
                        />
                    </a-form-item> 
                    <br/>-->
                    <!-- <a-form-item label="陪同部门">
                        <a-input placeholder="请输入陪同部门" v-model:value="formField.fcyptbm"/>
                    </a-form-item>
                    <a-form-item label="陪同人员">
                        <a-input placeholder="请输入陪同人员" v-model:value="formField.fcyptry"/>
                    </a-form-item>
                    <a-form-item label="陪同人员职务">
                        <a-input placeholder="请输入陪同人员职务" v-model:value="formField.fcyptryzw"/>
                    </a-form-item>
                    <br/> -->
                    <a-form-item label="审评结果" class="segment-long-box" >
                        <!-- <a-input placeholder="请输入审评结果" v-model:value="formField.fspjg"/> -->
                        <a-textarea 
                            v-if="!addEdittechnicalReview.isHidden"
                            style="width: 100% !important;"
                            @focus="ideaFocusEvent" 
                            @blur="ideaBlur"
                            placeholder="请输入审评结果" 
                            :rows="4" 
                            v-model:value="formField.fspjg"
                        />
                        <span v-else>{{ formField.fspjg }}</span>
                        <!-- @click="ideaClick('审评结果','fspjg')"  -->
                    </a-form-item>
                    <br/>
                    <a-form-item label="" class="segment-long-box btn-only" v-if="!addEdittechnicalReview.isHidden">
                        <a-button class="blue-btn" type="primary" @click="acquireDefectsClick()">获取缺陷项</a-button>
                    </a-form-item>
                    <a-form-item label="严重缺陷" class="segment-long-box" >
                        <a-input style="width: 100% !important;" placeholder="请输入严重缺陷" v-if="!addEdittechnicalReview.isHidden" v-model:value="formField.fspyzqx"/>
                        <span v-else>{{ formField.fspyzqx }}</span>
                    </a-form-item>
                    <br/>
                    <!-- <a-form-item label="主要缺陷" class="segment-long-box" >
                        <a-input style="width: 100% !important;" placeholder="请输入主要缺陷" v-if="!addEdittechnicalReview.isHidden" v-model:value="formField.fspzyqx"/>
                        <span v-else>{{ formField.fspzyqx }}</span>
                    </a-form-item>
                    <br/> -->
                    <a-form-item label="一般缺陷" class="segment-long-box" >
                        <a-input style="width: 100% !important;" placeholder="请输入一般缺陷" v-if="!addEdittechnicalReview.isHidden" v-model:value="formField.fspybqx"/>
                        <span v-else>{{ formField.fspybqx }}</span>
                    </a-form-item>
                    <br/>
                    <a-form-item label="需要说明的其他问题" class="segment-long-box" >
                        <a-input style="width: 100% !important;" placeholder="请输入需要说明的其他问题" v-if="!addEdittechnicalReview.isHidden"  v-model:value="formField.fspqtwt"/>
                        <span v-else>{{ formField.fspqtwt }}</span>
                    </a-form-item>
                </a-form>
                <a-collapse v-model:activeKey="collapseActiveKeyArr" class="tabs-collapse-box">
                    <a-collapse-panel key="5" header="报告生成">
                        <!-- <template #extra>
                            <span v-if="collapseActiveKeyArr.indexOf('5') !== -1" 
                            @click="collapseActiveKeyArr = collapseActiveKeyArr.filter(item => item !== '5')">折叠</span>
                            <span v-else @click="collapseActiveKeyArr.push('5')">展开</span>
                        </template>-->
                        <a-form layout="inline" style="margin-bottom:10px" v-if="!addEdittechnicalReview.isHidden">
                            <a-form-item >
                                <a-button class="blue-btn" type="primary" @click="generateRecord('技术审评报告','技术审评报告')">生成记录</a-button>
                            </a-form-item>
                        </a-form>
                        <commpVxeTable
                            :key="inspectionReportRefresh"
                            :config="inspectionReportConfig" 
                            :columns="inspectionReportColumns"
                            :formItem="[]" 
                            :adaptiveHeight="true"
                        > 
                            <template v-slot:fwjccmc_slots="{row}" data-desc="自定操作栏">
                                <span>{{ row.fwjxsmc }}{{ row.fwjlx }}</span>
                            </template>
                            <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                                <a-form layout="inline" class="search-form" >
                                    <a-form-item class="vxe-table-box-w">
                                        <a-button class="blue-btn" type="primary" @click="viewClick(row)" >查看</a-button>
                                    </a-form-item>
                                    <a-form-item v-if="editMode == '服务端模式'">
                                        <!-- 服务端编辑 -->
                                        <a-button class="blue-btn" type="primary" @click="serverEdit(row)" >编辑</a-button>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w" v-if="!addEdittechnicalReview.isHidden && row.fwjlx !== '.pdf' && editMode == '客户端模式'">
                                        <a-button class="blue-btn" type="primary" @click="editClick(row,'技术审评报告')" >编辑</a-button>
                                    </a-form-item>
                                    <a-form-item  v-if="row.fwjlx == '.pdf' && editMode == '客户端模式'">
                                            <a-button class="blue-btn dMould-btn" type="primary" @click="againEdit(row,'技术审评报告')" >重新编辑</a-button>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w" v-if="!addEdittechnicalReview.isHidden">
                                        <a-button class="red-btn" type="primary" @click="deleteClick(row,'技术审评报告')" >删除</a-button>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w" v-if="!addEdittechnicalReview.isHidden">
                                        <a-upload style="display: inline-block;" :beforeUpload="segmentBeforeUpload" action="" @change="uploadClick($event,row,'技术审评报告')">
                                            <a-button class="blue-btn" type="primary">上传</a-button>
                                        </a-upload>
                                    </a-form-item>
                                    <a-form-item class="vxe-table-box-w">
                                        <a-button class="blue-btn" type="primary" @click="downloadClick(row,'技术审评报告')" >下载</a-button>
                                    </a-form-item>
                                </a-form>
                            </template>
                        </commpVxeTable>
                    </a-collapse-panel>
                </a-collapse>
                <a-form 
                    v-if="!addEdittechnicalReview.isHidden"
                    style="margin-top: 20px;"
                    ref="form"
                    layout="inline" 
                    :form="inspectionReportForm" >
                    <a-form-item label="选择办理人">
                        <a-select
                            :key="compSelectorkey"
                            :options="HandledByOptions"
                            mode="multiple"
                            placeholder="请选择办理人"
                            style="width: 200px"
                            v-decorator="['dbrid',{ initialValue:formField.dbrid, rules: rules.dbrid}]"
                            
                            >
                        </a-select>
                    </a-form-item>
                    <a-form-item label="办理意见" class="comments-or-reasons-box">
                        <a-textarea 
                            @focus="ideaFocusEvent" 
                            style="width: 100% !important;"
                            @blur="ideaBlur"
                            @click="ideaClick('办理意见','opinion')" 
                            placeholder="请输入办理意见" 
                            :rows="4" 
                            v-decorator="['opinion',{ initialValue:formField.opinion, rules: rules.opinion}]"
                        />
                    </a-form-item>
                    <a-form-item label="下个环节">
                        <span style="padding-right: 30px;">{{formField.nextNode}}</span>短信通知<a-checkbox style="margin-left: 10px;" v-model:checked="formField.smgflag"></a-checkbox>
                    </a-form-item>
                </a-form>
                <a-form layout="inline" style="display: flex;justify-content: center;padding-top: 20px;" v-if="!addEdittechnicalReview.isHidden">
                    <a-form-item >
                        <a-button class="blue-btn" type="primary" @click="segmentSubmitClick(1)">保存</a-button>
                    </a-form-item>
                    <a-form-item >
                        <a-button class="blue-btn" type="primary" @click="segmentSubmitClick(2)" >提交</a-button>
                    </a-form-item>
                </a-form>
            </a-tab-pane>
        </a-tabs>
        <a-modal
            :title="ideaType"
            v-model:visible="ideaVisible"
            @ok="ideaHandleOk"
            class="idea-modal-box"
            @cancel="ideaVisible = false"
        >
            <a-form layout="inline">
                <a-form-item :label="ideaType" class="pull-input-w">
                    <div style="display: flex;align-items: center;">
                        <vxe-textarea
                         rows="3" 
                         @focus="recordCommentsFocus" 
                         @blur="recordCommentsBlur" 
                         @change="recordCommentsChange"  
                         v-model="opinionsText" 
                         :placeholder="'请输入或选择'+ideaType"
                         suffix-icon="vxe-icon-search"></vxe-textarea>
                        <a-button style="margin-left: 15px;" class="blue-btn"  type="primary" @click.stop="saveComments" >保存</a-button>
                    </div>
                    <!-- <vxe-input
                     @focus="recordCommentsFocus" 
                     @blur="recordCommentsBlur" 
                     @change="recordCommentsChange"  
                     v-model:value="opinionsText" 
                     :placeholder="'请输入或选择'+ideaType" 
                     suffix-icon="vxe-icon-search"></vxe-input> -->
                    <div class="opinion-record-box" v-show="isRecordComments">
                        <div v-if="segOpinionsList.length" class="content-box">
                            <div v-for="(item,index) in segOpinionsList" class="content-for">
                                <div @click.stop="selectIdea(item)"  class="content-item">
                                    <span class="content-text" v-if="ideaType=='办理意见'" >{{ item.fcontent}}</span>
                                    <span class="content-text" v-else >{{ item.fzdnr}}</span>
                                    <!-- item.fzdnr -->
                                    <a-button class="red-btn" size="small" type="primary" @click.stop="deleteIdea(item)" >删除</a-button>
                                </div>
                            </div>
                        </div>
                        <div class="no-data-box" v-else>暂无记录！</div>
                    </div>
                </a-form-item>
            </a-form>
        </a-modal>
        <a-modal
            title="查看"
            :visible="fcontentVisible"
            @ok="fcontentVisible = false"
            @cancel="fcontentVisible = false"
        >
            <p>
                <span style="font-weight: 600;">审查内容：</span>
                <span>{{ fcontent3 }}</span>
            </p>
            <p>
                <span style="font-weight: 600;">条款：</span>
                <span>{{ fcontent4 }}</span>
            </p>
            <p>
                <span style="font-weight: 600;">判断标准：</span>
                <span>{{ fcontent1 }}</span>
            </p>
            <p>
                <span style="font-weight: 600;">审评方法：</span>
                <span>{{ fcontent2 }}</span>
            </p>
        </a-modal>

        <a-modal
            title="查看"
            width="1000px"
            :visible="pdfVisible"
            @ok="pdfVisible = false"
            @cancel="pdfVisible = false"
            @afterClose="pdfAfterClose"
        >
            <div style="width: 100%;height: 420px;overflow: auto;">
                <pdf :src="iframeSrc" ref="myPdfComponent"></pdf>
            </div>
        </a-modal>
        
        <serverEditing ref="serverEditingRef" @refreshChange="refreshFunction(1)"/>
        <serverEditingView ref="serverEditingViewRef" @refreshChange="$event=>{}"/>
    </div>
</template>
<script>
import serverEditingView from '@/components/comp-model-series/server-editing-view'
import serverEditing from '@/components/comp-model-series/server-editing.vue'
import commpVxeTable from '@/components/commp-vxe-table/commp-vxe-table.vue'
import assessCheckApi from './service/api'
import compSelector from '@/components/compSelector/compSelector.vue'
import pdf from 'vue-pdf'
import CMapReaderFactory from 'vue-pdf/src/CMapReaderFactory.js'
import { 
    getLocalFileByIdServe,
    deletemodelByIdServe, 
    getFileTypeServe, 
    initWjjlServe, 
    queryListYwflServe, 
    spcyRsYwzdxxAddServe,
    spcyRsYwzdxxDeleteServe,
    getDefectRecordMapServe,
    addBatchIdeaServe,
    handlingOpinionsListServe,
    addServe,
    editServe,
    queryJcxmTreeTypeServe,
    queryJcxmListServe,
    ocalityPostAction,
    updateSqsxJcxmServe,
    getLocalFileById,
    deleteBatchIdeaServe,
    uploadMoreTypeFileServe,
    uploadPdfFileById,
    deleteFileByIdServe,
    againEditPdfFile
 } from './service/index'
import blobType from '@/common/blobType'
import TokenStorageUtil from "../../../utils/TokenStorageUtil";
import {typeInput, typeNumber, typeSelect, typeCheckbox, typeRadio} from '@/components/compSearchCriteria/ContractType'
import YchConstant from "@/api/YchConstant";
export default {
    components:{
        serverEditing,
        commpVxeTable,
        compSelector,
        pdf,
        serverEditingView,
    },
    props:{
        addEdittechnicalReview:{
            type:[Array,Object],
            default: () => {},
            required:false
        }
    },
    watch:{
        addEdittechnicalReview:{
            handler (newval, oldVal) {
                if(newval){
                    //console.log('流程二参数',newval)
                    this.HandledByOptions = []
                    this.formField = JSON.parse(JSON.stringify(newval))
                     this.formField.nextNodeDbrList.forEach(item => {
                            item = {
                                value:item.dbrid,
                                label:item.dbr
                            }
                            let arr = this.HandledByOptions.filter(i=>i.value == item.dbrid)
                            if(!arr.length){
                                this.HandledByOptions.push(item)
                            }
                        });
                    this.$forceUpdate()
                    this.refreshFunction(1)
                }
            },
            immediate: true,
            deep: true
        },
    },
    data(){
        return{
            blobType:blobType,
            routeName:this.$route.name,
            typeSelect:typeSelect,
            formField:{},
            inspectionReportForm:this.$form.createForm(this, { name: 'inspectionReportFormName' }),
            rules:{
                opinion: [{
                    required: true,
                    message: '请输入办理意见',
                    trigger: 'blur',
                }],
                dbrid: [{
                    type:'array',
                    required: true,
                    message: '请选择办理人',
                    trigger: 'blur',
                }]
            },
            HandledByOptions:[],
            collapseActiveKeyArr:['1','2','3','4','5'],
            tabsModeValue:'人员和文件信息',
            //审评方案
            inspectionPlanRefresh:null,
            inspectionPlanConfig:{
                api:assessCheckApi.queryXcspWjjl,
                rowId: 'id',
                fywflcode:blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],
                height:400,
                autoHidden:true,
                pageSize:100,
                listData:'spfaList',
                paramet:{
                    sqsxid:this.addEdittechnicalReview.sqsxid
                }
            },
            inspectionPlanColumns:[{
                title: '方案', //列头显示文字
                field: 'fwjccmc',
                slots: {
                    // 使用插槽模板渲染
                    default: 'fwjccmc_slots',
                },
            },{
                title: '操作',
                field: 'id',
                slots: {
                    // 使用插槽模板渲染
                    default: 'operation_btn',
                },
                width:300,
                fixed:'right'
            }],
            // 专家签到表
            honestAutonomyRefresh:null,
            honestAutonomyConfig:{
                api:assessCheckApi.queryXcspWjjl,
                rowId: 'id',
                fywflcode:blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],
                height:400,
                autoHidden:true,
                pageSize:100,
                listData:'zjqdbList',
                paramet:{
                    sqsxid:this.addEdittechnicalReview.sqsxid
                }
            },
            honestAutonomyColumns:[{
                title: '专家签到表', //列头显示文字
                field: 'fwjccmc',
                slots: {
                    // 使用插槽模板渲染
                    default: 'fwjccmc_slots',
                },
            },{
                title: '操作',
                field: 'id',
                slots: {
                    // 使用插槽模板渲染
                    default: 'operation_btn',
                },
                width:300,
                fixed:'right'
            }],
            //技术审评意见审批表
            customerSatisfactionRefresh:null,
            customerSatisfactionConfig:{
                api:assessCheckApi.queryXcspWjjl,
                rowId: 'id',
                fywflcode:blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],
                height:400,
                autoHidden:true,
                pageSize:100,
                listData:'jsspyjspbList',
                paramet:{
                    sqsxid:this.addEdittechnicalReview.sqsxid
                }
            },
            customerSatisfactionColumns:[{
                title: '技术审评意见审批表', //列头显示文字
                field: 'fwjccmc',
                slots: {
                    // 使用插槽模板渲染
                    default: 'fwjccmc_slots',
                },
            },{
                title: '操作',
                field: 'id',
                slots: {
                    // 使用插槽模板渲染
                    default: 'operation_btn',
                },
                width:300,
                fixed:'right'
            }],
            //专家审评意见
            noConflictOfInterestRefresh:null,
            noConflictOfInterestConfig:{
                api:assessCheckApi.queryXcspWjjl,
                rowId: 'id',
                fywflcode:blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],
                height:400,
                autoHidden:true,
                pageSize:100,
                listData:'zjspyjList',
                paramet:{
                    sqsxid:this.addEdittechnicalReview.sqsxid
                }
            },
            noConflictOfInterestColumns:[{
                title: '专家审评意见', //列头显示文字
                field: 'fwjccmc',
                slots: {
                    // 使用插槽模板渲染
                    default: 'fwjccmc_slots',
                },
            },{
                title: '操作',
                field: 'id',
                slots: {
                    // 使用插槽模板渲染
                    default: 'operation_btn',
                },
                width:300,
                fixed:'right'
            }],
           
            //报告生成
            inspectionReportRefresh:null,
            inspectionReportConfig:{
                api:assessCheckApi.queryXcspWjjl,
                rowId: 'id',
                fywflcode:blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],
                height:400,
                autoHidden:true,
                pageSize:100,
                listData:'jsspbgList',
                paramet:{
                    sqsxid:this.addEdittechnicalReview.sqsxid
                }
            },
            inspectionReportColumns:[{
                title: '报告名称', //列头显示文字
                field: 'fwjccmc',
                slots: {
                    // 使用插槽模板渲染
                    default: 'fwjccmc_slots',
                },
            },{
                title: '操作',
                field: 'id',
                slots: {
                    // 使用插槽模板渲染
                    default: 'operation_btn',
                },
                width:750,
                fixed:'right'
            }],

            //弹窗选择
            ideaVisible:false,
            opinionsText:'',
            ideaType:'',
            segOpinionsList:[],
            isRecordComments:false,
            formFieldKey:'',
            compSelectorkey:null,

            //审评项目
            treeCheckedKeys:[],
            selectedKeys:[],
            treeData:[],
            reviewItemsFormItem:[
                {
                    label: '章节',
                    model: 'ftype5',
                    
                },{
                    label: '审评结论',
                    model: 'fjcjl',
                    separateAreas: 'jcxmqxzt'+blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],
                    dictionaryType:'审评结论',
                    type:typeSelect,
                },{
                    label: '审评记录',
                    model: 'fscjl',
                }
            ],
            reviewItemsRefresh:null,
            reviewItemsConfig:{
                api: assessCheckApi.queryJcxmList,
                rowId: 'id',
                fywflcode:blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],
                height:480,
                pageSize:1000,
                paramet:{
                    type:'审评项目',
                    sqsxid:this.addEdittechnicalReview.sqsxid,
                    sfqx:'yes',
                }
            },
            reviewItemsColumns:[{
                    title: '序号', //列头显示文字
                    field: 'fxh',
                    width:100,
                },{
                    title: '项目类型', //列头显示文字
                    field: 'ftype4',
                    width:200,
                },{
                    title: '章节',
                    field: 'ftype5',
                    slots: {
                        // 使用插槽模板渲染
                        default: 'name_ftype4',
                    },
                    width:120,
                },{
                    title: '审评结论',
                    field: 'fjcjl',
                    slots: { default: 'name_fjcjl' },
                    titlePrefix:{icon:'vxe-icon-edit'},
                    width:120,
                },{
                    title: '审评记录',
                    field: 'fscjl',
                    slots: { default: 'name_fscjl' },
                    titlePrefix:{icon:'vxe-icon-edit'},
                }],
                reviewRecordsId:'',
                fscjlValue:'',
                fcontent1:'',
                fcontent2:'',
                fcontent3:'',
                fcontent4:'',
                fcontentVisible:false,
                iframeSrc:'',
                pdfVisible:false,
            

        }
    },
    computed: {
        editMode(){
            return this.$store.state.permission.editMode
        },
    },
    created(){
        this.getTreeData()//获取审评项目的树形
    },
    updated(){
        this.$emit('updatedSuccess')
    },
    methods:{
        async dictionaryQuery(val){
            //console.log(val)
            let dataObj = []
            ocalityPostAction({dictName:val}).then(res=>{
                //console.log('字典的res',res)
                if(res.code == 200){
                    if(res.result.length){
                        dataObj = res.result
                        //console.log(dataObj)
                    }
                    
                }
            })
            
            //console.log('dataObj',dataObj)
            return dataObj
        },
        refreshFunction(name){
            //console.log(name)
            if(name === '审评方案' || name == 1){
                this.inspectionPlanRefresh = Date.now()
            }
            if(name === '专家签到表' || name == 1){
                this.honestAutonomyRefresh = Date.now()
            }
            if(name === '技术审评意见审批表' || name == 1){
                this.customerSatisfactionRefresh = Date.now()
            }
            if(name === '专家审评意见' || name == 1){
                this.noConflictOfInterestRefresh = Date.now()
            }
            if(name == '技术审评报告' || name == 1){
                //console.log(333,'技术审评报告')
                this.inspectionReportRefresh = Date.now()
            }
            

        },
        segmentBeforeUpload(){ return false },
        viewClick(val){
            this.$refs.serverEditingViewRef.getData({id:val.id,fwjlx:val.fwjlx})
            this.$refs.serverEditingViewRef.serverEditingVisible = true
        },
        //查看
        lookOverClick(val){
            getFileTypeServe({id:val.id}).then(res=>{
                if(res.code == 200){
                    if(res.result == '.pdf'){
                        window.open(
                            bootConfig[process.env.NODE_ENV].locality_ApI+YchConstant.SPZX_SPCY+'/spcySqsxWjjl/getCrossLocalFile?id='+val.id
                        )
                    }else{
                        this.$message.warning('只能查看pdf文件')
                    }
                    
                }
                
            })
            
        },
        //下载
        downloadClick(val,name){
            var that = this
            var fileName = val.fwjccmc
            let param = { fywflcode:blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],id:val.id,sqsxid:this.formField.sqsxid}
            getFileTypeServe({id:val.id}).then(res=>{
                if(res.code == 200){
                    getLocalFileByIdServe(param).then((data) => {
                        if (!data) {
                            that.$message.warning('文件下载失败')
                        return
                        }
                        // if (typeof window.navigator.msSaveBlob !== 'undefined') {
                        //     window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }))
                        // } else {
                            let url = window.URL.createObjectURL(new Blob([data], { type: blobType.type[blobType.suffix.indexOf(val.fwjlx)] }))
                            let link = document.createElement('a')
                            link.style.display = 'none'
                            link.href = url
                            link.setAttribute('download', fileName + res.result)
                            document.body.appendChild(link)
                            link.click()
                            document.body.removeChild(link) //下载完成移除元素
                            window.URL.revokeObjectURL(url) //释放掉blob对象
                        // }
                    })
                }
                
            })
        },
        deleteClick(val,name){
            var that = this
            this.$confirm({
                title:'您确认要删除吗？',
                // icon: createVNode(ExclamationCircleOutlined),
                onOk() {
                    deleteFileByIdServe({id:val.id}).then(res=>{
                        if(res.code == 200){
                            that.refreshFunction(name)
                            that.getHandlingOpinionsList(that.ideaType,that.opinionsText)
                        }else{
                            that.$message.warning(res.message)
                        }
                    })
                },
                
            });
            
        },
        //重新编辑
        againEdit(val,name){
            var that = this
            this.$confirm({
                title:'您确认删除已生成的pdf重新编辑文档吗？',
                // icon: createVNode(ExclamationCircleOutlined),
                onOk() {
                    againEditPdfFile({id:val.id}).then(res=>{
                        if(res.code == 200){
                            that.$webOffice(
                                `api/spzx-spcy/spcyRsWjmb/openWjjl?id=${res.result.id}`,
                                `api/spzx-spcy/spcyRsWjmb/onLineSaveWjjl?id=${res.result.id}`+`-name=${val.fwjlx1+val.fwjlx}`,
                                `api/spzx-spcy/spcyRsWjmb/saveFileToPdf2?id=${res.result.id}`+`&sqsxid=${that.formField.sqsxid}`,
                                `api/spzx-spcy/spcyRsWjmb/saveFileGzToPdf2?id=${res.result.id}`+`&sqsxid=${that.formField.sqsxid}`,
                                `api/spzx-spcy/spcyRsWjmb/againEditOutPdfFile?id=${res.result.id}`,
                            )
                            that.refreshFunction(name)
                        }else{
                            that.$message.warning(res.message)
                        }
                    })
                },
                
            });
        },
        //服务端编辑
        serverEdit(val){
            this.$refs.serverEditingRef.getData(val)
        },
        //在线编辑
        editClick(val,name){
            var that = this
            //console.log('在线编辑',val)
            if(val.fwjlx == '.pdf'){
                this.$message.warning('pdf文件无法编辑')
            }else{
                // window.localStorage.setItem('FieldPdf','0')
                // this.modelType = 2
                getFileTypeServe({id:val.id}).then(res=>{
                    if(res.code == 200){
                        if(res.result !== '.pdf'){
                            that.$webOffice(
                                `api/spzx-spcy/spcyRsWjmb/openWjjl?id=${val.id}`,
                                `api/spzx-spcy/spcyRsWjmb/onLineSaveWjjl?id=${val.id}`+`-name=${val.fwjlx1+val.fwjlx}`,
                                `api/spzx-spcy/spcyRsWjmb/saveFileToPdf2?id=${val.id}`+`&sqsxid=${this.formField.sqsxid}`,
                                `api/spzx-spcy/spcyRsWjmb/saveFileGzToPdf2?id=${val.id}`+`&sqsxid=${this.formField.sqsxid}`,
                                `api/spzx-spcy/spcyRsWjmb/againEditOutPdfFile?id=${val.id}`,
                            )
                        }else{
                            this.refreshFunction(name)
                            this.$message.warning('pdf文件无法编辑')
                        }
                        
                    }
                    
                })
                
            }
        },
        //上传
        uploadClick({file},val){//
            var that = this
            if(typeof file.uid !== 'undefined') {
                // if(file.name.indexOf(".xls") !== -1 || file.name.indexOf(".xlsx") !==-1) {
                    const fileData = new FormData();
                    fileData.append("file",file);
                    fileData.append("fywflcode",blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))]);
                    fileData.append("id",val.id);
                    fileData.append("sqsxid",this.formField.sqsxid);
                    
                    uploadPdfFileById(fileData).then(res => {
                        if(res.code !== 200){
                            that.$message.warning('请上传pdf文件或者联系管理员!')
                        }else{
                            this.refreshFunction(1)
                            that.$message.success('上传成功')
                        }
                    })
                // }
                
            }
        },
        //生成记录
        generateRecord(val,name){
            //console.log(name)
            initWjjlServe({sqsxid:this.formField.sqsxid,type:val}).then(res=>{
                if(res.code == 200){
                    this.refreshFunction(name)
                    this.$message.success(res.message)
                }else{
                    this.$message.warning(res.message)
                }
            })
        },
        /* ------------审评项目----------- */
        matterTree(data,val) {
            var a = val+1
            for (var i = 0; i < data.length; i++) {
                // 这里面就是你处理数据的地方 
                // data[i].width = '200'
                if (data[i].children && data[i].children.length > 0) {
                // children若不为空数组，则继续 递归调用 本方法
                // data[i].children['name'+i] = data[i].title
                // //console.log('@@data[i].children',data[i].children)
                //建议用父级的key来做 
                let datas ={}
                datas['type'+a] = data[i].title
                datas['key'+a] = data[i].key
                let currentData = {...data[i],children:{}}
                data[i].children = data[i].children.map(item=> {return{...currentData,...item,...datas}})
                this.matterTree(data[i].children,a)
                }
            }
            return data
        },
        getTreeData(){//获取树形
            queryJcxmTreeTypeServe({sqsxid:this.formField.sqsxid,type:'审评项目'}).then(res=>{

                if(res.code == 200){
                    this.treeData = this.matterTree(res.result,0)
                    //console.log('改造后的树形',this.treeData)
                    
                }
            })
        },
        // getTreeTableData(val){//获取审评项目数据
        //     // reviewItemsRef
        //     let data = {
        //         sqsxid:this.formField.sqsxid,
        //         ...val

        //     }
        // },
        treeSelect(val,item){//选择树
            //console.log('选择树',val)
            this.selectedKeys = val
            if(val.length && item.node && item.node._props && item.node._props.dataRef){

                let data = item.node._props.dataRef
                // this.selectedKeys.push(val[0])
                // for (let key in data) {
                //     if(key.indexOf('key') !== -1 && key.length>3){
                //         this.selectedKeys.push(data[key])
                        
                //     }
                // }
                this.reviewItemsConfig.paramet = {
                    sqsxid:this.addEdittechnicalReview.sqsxid,
                    type:'审评项目',
                    sfqx:'yes',
                    type1:data.type1 ?data.type1:data.title,
                    type2:data.type2 ?data.type2:(data.type1?data.title:''),
                    type3:data.type3 ?data.type3:(data.type2?data.title:''),
                    type4:data.type4 ?data.type4:(data.type3?data.title:''),
                    type5:data.type5 ?data.type5:(data.type4?data.title:''),
                    type6:data.type6 ?data.type6:(data.type5?data.title:''),
                    type7:data.type7 ?data.type7:(data.type6?data.title:''),
                    type8:data.type8 ?data.type8:(data.type7?data.title:''),
                    type9:data.type9 ?data.type9:(data.type8?data.title:''),
                }
                this.$refs.reviewItemsRef.searchEvent()
            }
            if(!val.length){
                this.reviewItemsConfig.paramet = {
                    sqsxid:this.addEdittechnicalReview.sqsxid,
                    type:'审评项目',
                    sfqx:'yes',
                }
                this.$refs.reviewItemsRef.searchEvent()
            }
        },
        lookOverContent(val){
            this.fcontent1 = val.fcontent1
            this.fcontent2 = val.fcontent2
            this.fcontent3 = val.ftype4
            this.fcontent4 = val.ftype5
            this.fcontentVisible = true
        },
        selectHandleChange(val,row){
            updateSqsxJcxmServe({fjcjl:val,id:row.id}).then(res=>{
                if(res.code == 200){
                    this.$message.success('修改成功')
                    this.$refs.reviewItemsRef.searchEvent()
                }else{
                    this.$message.warning(res.message)
                }
            })
        },
        reviewRecordsClick(val,isHidden){
            if(!isHidden){
                this.fscjlValue = val.fscjl
                this.reviewRecordsId = val.id
                this.$nextTick(() => {
                    this.$refs.userNameInput.focus()
                    this.reviewRecordsFocusEvent()
                })
            }
            
        },
        reviewRecordsFocusEvent(){

        },
        reviewRecordsBlurEvent(val){
            //console.log('当前得到了什么？',val)
            var that = this
            if(val.fscjl && (val.fscjl !== this.fscjlValue)){
                updateSqsxJcxmServe({fscjl:val.fscjl,id:val.id}).then(res=>{
                    if(res.code == 200){
                        this.$message.success('修改成功')
                        this.$refs.reviewItemsRef.searchEvent()
                        this.reviewRecordsId = ''
                    }else{
                        this.$message.warning(res.message)
                        that.$nextTick(() => {
                            that.$refs.userNameInput.focus()
                            that.reviewRecordsFocusEvent()
                        })
                    }
                })
            }else if(this.fscjlValue && !val.fscjl){
                this.$confirm({
                    title:'您确认要保存空的吗？',
                    // icon: createVNode(ExclamationCircleOutlined),
                    onOk() {
                        updateSqsxJcxmServe({fscjl:val.fscjl,id:val.id}).then(res=>{
                            if(res.code == 200){
                                that.$message.success('修改成功')
                                that.$refs.reviewItemsRef.searchEvent()
                                
                            }else{
                                that.$message.warning(res.message)
                                that.$nextTick(() => {
                                    that.$refs.userNameInput.focus()
                                    that.reviewRecordsFocusEvent()
                                })
                            }
                            this.reviewRecordsId = ''
                        })
                        this.reviewRecordsId = ''
                    },
                    onCancel(){
                        that.$refs.reviewItemsRef.searchEvent()
                        this.reviewRecordsId = ''
                    }
                    
                });
            }else{
                this.reviewRecordsId = ''
            }
        },
        
        /* ------------审评项目----------- */

        getHandlingOpinionsList(ideaType,val){//查询业务类型
            
            if(ideaType == '办理意见'){
                handlingOpinionsListServe({ftype1:ideaType,pageNo:1,pageSize:1000,fcontent:val}).then(res=>{
                    if(res.code == 200){
                        //console.log('办理意见',res)
                        this.segOpinionsList = res.result.records
                    }
                })

            }else{
                queryListYwflServe({ftype1:ideaType,fzdnr:val}).then(res=>{
                    if(res.code == 200){
                        //console.log('查询弹窗数据',res)
                        this.segOpinionsList = res.result
                    }
                })
            }
            
        },
        //弹窗输入框输入
        recordCommentsChange(){
            this.getHandlingOpinionsList(this.ideaType,this.opinionsText)
        },
        //选择弹窗选择
        selectIdea(val){
            this.opinionsText = this.ideaType == '办理意见'?val.fcontent:val.fzdnr
            this.isRecordComments = false
        },
        recordCommentsFocus(){
            this.isRecordComments = true
        },
        recordCommentsBlur(){},
        
        //删除意见
        deleteIdea(val,name){
            if(this.ideaType == '办理意见'){
                deleteBatchIdeaServe({ids:val.id}).then(res=>{
                    if(res.code == 200){
                        this.refreshFunction(name)
                        this.$message.success('删除成功')
                    }else{
                        this.$message.warning(res.message)
                    }
                })
            }else{
                spcyRsYwzdxxDeleteServe({id:val.id}).then(res=>{
                    if(res.code == 200){
                        this.refreshFunction(name)
                        this.$message.success('删除成功')
                    }else{
                        this.$message.warning(res.message)
                    }
                })
            }
            
        },
        ideaHandleOk(){
            this.ideaVisible = false
            // if(this.opinionsText !== this.formField[this.formFieldKey]){
                
                this.formField[this.formFieldKey] = this.opinionsText
                if(this.formFieldKey == 'opinion'){
                    this.inspectionReportForm.setFieldsValue({
                        opinion:this.opinionsText,
                    });
                }
                
            // }
            
            
            
        },
        saveComments(){
            this.ideaHandleOk()
            if(this.opinionsText){
                if(this.ideaType == '办理意见'){
                    addBatchIdeaServe({ftype1:this.ideaType,fcontent:this.opinionsText}).then(res=>{
                        this.getHandlingOpinionsList(this.ideaType,this.opinionsText)
                    })
                }else{
                    spcyRsYwzdxxAddServe({ftype1:this.ideaType,fzdnr:this.opinionsText}).then(res=>{
                        this.getHandlingOpinionsList(this.ideaType,this.opinionsText)
                    })
                }
            }
        },
        ideaFocusEvent(){
            // this.ideaBlur()
        },
        ideaBlur(){},
        //打开弹窗
        ideaClick(val,name){
            this.ideaVisible = true
            this.formFieldKey = name
            this.ideaType = val
            this.opinionsText = this.formField[name]
            this.getHandlingOpinionsList(val,this.formField[name])
        },
        acquireDefectsClick(){//获取缺陷项
            getDefectRecordMapServe({sqsxid:this.formField.sqsxid}).then(res=>{
                if(res.code == 200){
                    this.formField.fspybqx = res.result.fspybqx
                    this.formField.fspyzqx = res.result.fspyzqx
                    this.formField.fspzyqx = res.result.fspzyqx
                }else{
                    this.$message.warning(res.message)
                }
            })
        },
        segmentSubmitClick(val){
            var that = this
            if(val == 1){
                let data = {
                    jobid:that.formField.jobid,
                    sqsxid:that.formField.sqsxid,
                    dbrid:'',
                    opinion:'',
                    smgflag:that.formField.smgflag?'是':'否',
                    map:{
                        fspyj:that.formField.fspyj,
                        // fcyjcfw:that.formField.fcyjcfw,
                        // fcyptbm:that.formField.fcyptbm,
                        // fcyptry:that.formField.fcyptry,
                        // fcyptryzw:that.formField.fcyptryzw,
                        fspjg:that.formField.fspjg,
                        fspyzqx:that.formField.fspyzqx,
                        fspzyqx:that.formField.fspzyqx,
                        fspybqx:that.formField.fspybqx,
                        fspqtwt:that.formField.fspqtwt,
                    }
                }
                addServe(data).then(res=>{
                    if(res.code == 200){
                        that.$emit('successReturn',true)
                        that.$message.warning(res.message)
                    }else{
                        that.$message.warning(res.message)
                    }
                })
            }else if(val == 2){

                this.inspectionReportForm.validateFields((err, values) => {
                    if(!err){
                        let data = {
                            jobid:that.formField.jobid,
                            sqsxid:that.formField.sqsxid,
                            dbrid:values.dbrid.join(','),
                            opinion:values.opinion,
                            smgflag:that.formField.smgflag?'是':'否',
                            map:{
                                fspyj:that.formField.fspyj,
                                // fcyjcfw:that.formField.fcyjcfw,
                                // fcyptbm:that.formField.fcyptbm,
                                // fcyptry:that.formField.fcyptry,
                                // fcyptryzw:that.formField.fcyptryzw,
                                fspjg:that.formField.fspjg,
                                fspyzqx:that.formField.fspyzqx,
                                fspzyqx:that.formField.fspzyqx,
                                fspybqx:that.formField.fspybqx,
                                fspqtwt:that.formField.fspqtwt,
                            }
                        }
                        editServe(data).then(res=>{
                            if(res.code == 200){
                                that.$emit('successReturn',false)
                            }else{
                                that.$message.warning(res.message)
                            }
                        })
                    }
                })
            }
        },
        pdfAfterClose(){
            //console.log('弹窗有回调吗？')
        }
    }
}
</script>
<style lang="less">
.segment-content-box{
    .ant-tabs{
        margin-top: 20px;
    }
    .ant-tabs-nav .ant-tabs-tab-active {
        color: #5ca3e5;
        background: #5ca3e5;
        color: #fff;
        border-top-left-radius: 10px;
    }
    .ant-tabs-ink-bar{
        background: #5ca3e5 !important;
    }
    .ant-tabs-tab-active:hover{
        color: #fff !important;
    }
    // .ant-tabs-nav .ant-tabs-tab:hover{
    //     color: #fff !important;
    // }
}
.btn-only{
    .ant-form-item-control-wrapper{
        margin-left: 142px;
        margin-top: 20px;
    }
}
.segment-long-box{
    width: 100%;
    .ant-form-item-control-wrapper{
        width: 80%;
    }
}
.label-box-w{
    .ant-form-item-label{
        width: 142px;
    }
}
.tree-left-box{
    width: 240px;
    padding: 15px;
    height: 480px;
    overflow: auto;
}
.tree-right-box{
    min-width: 1000px;
}


</style>